var prefix;
var tType;

function onClick(e, treeId, treeNode) {

	var zTree = $.fn.zTree.getZTreeObj("treeDemo");
	zTree.expandNode(treeNode);
	var manframe = window.parent.window.document.getElementById("mainFrame");
	var url;

	if (tType == "channel") {
		var check = (treeNode && !treeNode.isParent);
		if (!check) {
			url = "../" + prefix + "/list.do?root=" + treeNode.id;
		} else {
			url = "../" + prefix + "/edit.do?id=" + treeNode.id
					+ "&model_type=1" + treeNode.userdata;
		}
	} else if (tType == "content") {
		url = "../" + prefix + "/list.do?root=" + treeNode.id;
	}

	manframe.src = url;
}

function showMenu(parameter) {

	prefix = parameter.url;
	tType = parameter.type;
	var setting = {
		view : {
			dblClickExpand : false,
			selectedMulti : false
		},
		async : {
			enable : true,
			url : "../../channelAction/channel/tree.do",
			type : "get"
		},
		callback : {
			onClick : onClick
		}
	};
	$.fn.zTree.init($("#treeDemo"), setting);
}